package com.xy.demo.service.impl;

import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper;
import com.xy.demo.Util.ResultUtil;
import com.xy.demo.Util.Util;
import com.xy.demo.mapper.mysql.RoleMapper;
import com.xy.demo.model.Params;
import com.xy.demo.model.ResultInfo;
import com.xy.demo.model.Role;
import com.xy.demo.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleMapper roleMapper;

    @Override
    public ResultInfo getAll(Params params) {
        if(params.getPageNum()!=null&&params.getPageSize()!=null){
            PageHelper.startPage(params.getPageNum(),params.getPageSize(),true);
        }
        List<Role> list = roleMapper.getAll(params);
        ResultInfo resultInfo = ResultUtil.getResultInfoOk(list);
        return resultInfo;
    }




}
